<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>动画demo</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
      .transition-box-gery {
        width: 300px;
        margin-bottom: 10px;
        height: 1px;
        border-radius: 4px;
        background-color: #909399;
        text-align: center;
        color: #ffffff;
        box-sizing: border-box;
        margin-right: 20px;
      }
      #transition-box {
        width: 300px;
        margin-bottom: 10px;
        height: 1px;
        border-radius: 4px;
        background-color: #909399;
        text-align: center;
        color: #ffffff;
        box-sizing: border-box;
        margin-right: 20px;
      }
      .el-zoom-in-center-enter-active,
      .el-zoom-in-center-leave-active {
        transition: all 0.3s cubic-bezier(0.55, 0, 0.1, 1);
      }
      .el-zoom-in-center-enter,
      .el-zoom-in-center-leave-to {
        opacity: 0;
        transform: scaleX(0);
      }
      .el-zoom-in-center-enter-to,
      .el-zoom-in-center-leave {
        opacity: 1;
        /* transform: scaleX(0); */
      }

      @keyframes zoomIn {
        from {
          opacity: 0;
          transform: scaleX(0);
        }

        50% {
          opacity: 1;
        }
      }

      .zoomIn {
        /* animation-name: zoomIn; */
        animation: zoomIn 0.6s cubic-bezier(0.55, 0, 0.1, 1) 0s;
      }

      @keyframes zoomOut {
        from {
          opacity: 1;
        }

        50% {
          opacity: 0;
          transform: scale3d(0.3, 0.3, 0.3);
        }

        to {
          opacity: 0;
        }
      }

      .zoomOut {
        /*animation-name: zoomOut;*/
        animation: zoomOut 0.6s cubic-bezier(0.55, 0, 0.1, 1) 0.3s;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <div>{{ title }}</div>
      <input
        type="text"
        style="margin-bottom: 80px;"
        @focus="change"
        @blur="className = ''"
      />
      <transition name="el-zoom-in-center">
        <div v-show="true" class="transition-box-gery"></div>
      </transition>
      <div>看看位置是否有变化,有让他固定下来</div>

      <div :class="className" id="transition-box"></div>

      <div>看看位置是否有变化,有让他固定下来</div>
    </div>
  </body>
  <script>
    var app = new Vue({
      el: "#app",
      data: {
        title: "动画显示",
        show: true,
        className:'zoomIn'
      },
      methods: {
        change() {
          this.className = this.className==='zoomIn'?'':'zoomIn'
        }
      }
    });
  </script>
</html>
